package com.gkd.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkd.pojo.dto.PostPageQueryDTO;
import com.gkd.pojo.entity.Post;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkd.pojo.entity.Tag;
import com.gkd.pojo.vo.PostVO;
import com.gkd.pojo.vo.PublishListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author ZJF
* @description 针对表【post】的数据库操作Mapper
* @createDate 2024-06-15 18:18:43
* @Entity com.gkd.pojo.entity.Post
*/
@Mapper
public interface PostMapper extends BaseMapper<Post> {

    IPage<PostVO> selectPostsPage(@Param("page") Page<PostVO> page, @Param("postPageQueryDTO") PostPageQueryDTO postPageQueryDTO);

    @Select("SELECT SUM(views) FROM post")
    Long sumView();

    List<PublishListVO> countPostsByDayInRange(@Param("startDate")Date startDate, @Param("endDate")Date endDate);
    List<Map<String,Object>> selectCategoryPostCounts();

}




